package paywithdrawlogic

import (
	"context"

	"gitee.com/liuxuezhan/ar-platform/assets-rpc/internal/dao/model/withdraw"
	"gitee.com/liuxuezhan/ar-platform/assets-rpc/internal/svc"
	"gitee.com/liuxuezhan/ar-platform/assets-rpc/rpc"
	"gorm.io/gorm"

	"github.com/zeromicro/go-zero/core/logx"
)

type WithdrawFailLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
	tx *gorm.DB
}

func NewWithdrawFailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WithdrawFailLogic {
	return &WithdrawFailLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *WithdrawFailLogic) WithdrawFail(in *rpc.FailWithDrawReq) (*rpc.FailWithDrawRes, error) {
	// todo: add your logic here and delete this line

	// 初始化模型
	m := withdraw.NewWithdrawModel(l.ctx, l.svcCtx)
	err := m.WithdrawFail(in)
	if err != nil {
		return nil, err
	}
	ret := &rpc.FailWithDrawRes{}

	return ret, nil
}
